feat(issue-94): optional transactions and version-control layers#95
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #94
…ayers Compiles issue-94 evidence under docs/case-studies/issue-94/ as the issue requires before any code changes: raw issue/PR snapshots, upstream UInt64LinksTransactionsLayer C# and C++ references, a 23-requirement decomposition (transactions, version control, cross-cutting), and a step-by-step solution plan that maps to the existing decorator stack (SimpleLinks → NamedTypes → PinnedTypes → PersistentTransformation) and explains how to add the new optional transactions + version-control decorators on top in both C# and Rust. Links the case study from the root README.
Working session summaryPR #95 is updated. Here's what landed: Commit: PR: #95 (still draft per the issue's "single PR" instruction; follow-up code commits S2–S8 are planned in §6 of the case study) What's in the case study (
CI workflows are path-gated to Next steps (per the case study) are the code commits implementing S2–S8: API surface, doublets-backed transitions log, sync/async commit, log retention, recovery, This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $4.169027📊 Context and tokens usage:Claude Opus 4.7:
Total: (91 new + 101.2K cache writes + 5.6M cache reads) input tokens, 26.0K output tokens, $4.095874 cost Claude Haiku 4.5:
Total: 58.1K input tokens, 3.0K output tokens, $0.073153 cost 🤖 Models used:
📎 Log file uploaded as Gist (2038KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
This reverts commit 82d361a.
These are wrong. I explicitly said we doing everything in this pull request. Re-read #94 and continue to deliver for both Rust and C# in the most widest and deepest sense. We need to ensure all changes are correct, consistent, validated, tested, documented, logged and fully meet each and all discussed requirements in deepest and widest possible sense (check issue description and all comments in issue and in pull request, make sure each and every requirement listed before actually checking if they were addressed). Ensure all CI/CD checks pass. Please plan and execute everything in a single pull request, you have unlimited time and context, as context auto-compacts and you can continue indefinitely, until it is each and every requirement fully addressed, and everything is totally done. |
|
🤖 AI Work Session Started Starting automated work session at 2026-05-20T13:00:55.141Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback. |
Introduces an optional decorator that records every Create/Update/Delete as a reversible Transition stored as a named link in a sidecar doublets log store. Supports explicit transactions (BeginTransaction/Commit/ Rollback/Dispose with auto-rollback), sync and async commit modes, three retention policies (Infinite, Chunked archive, Sized with applied-check), and crash recovery that re-applies committed transitions and rolls back uncommitted ones.
…dling The underlying doublets store fires the write handler multiple times for one logical write (Delete first clears the link, then removes it). The previous transition recorder logged each callback as a separate transition and then refused to revert when the slot was already restored from an earlier callback. Collapse all callbacks for a single Create/Update/Delete into one transition whose Before is the first observed before-state and whose After is the last observed after-state. Also simplify Delete revert: doublets storage reuses freed slots in order, so a single CreateAndUpdate(source, target) restores the link in place without needing a separate Update step. 12 new tests cover: auto transactions, rollback of Create/Update/Delete, dispose-without-commit auto rollback (R10), commit persistence, sized retention with applied-check (R7), chunked retention archive directory, retention spec parsing, transition round-trip serialization, async commit applied-sequence, and no behaviour change when not opted in (R8).
Adds the VC layer described in step S5 of docs/case-studies/issue-94: * sits above the transactions decorator and tags each new transition with the current branch * Branch / SwitchBranch / Checkout / Tag operations backed by markers in a sidecar doublets store * Recover() rebuilds state from the markers * TransactionsDecorator exposes RevertTransition / ApplyTransition so the VC layer can drive replay/rewind without producing log entries Covers requirements R11-R17 and adds 11 VC tests; all 210 tests pass.
Adds --transactions/--transactions-file/--commit-mode/--retention flags to opt into the TransactionsDecorator layer, and --vc/--vc-file plus --branch/--branch-from/--checkout/--tag/--list-branches/--list-tags/ --log to drive the VersionControlDecorator. Layers compose on demand and remain off by default (R8 + R17: no behaviour change when not opted in).
Mirrors the C# `TransactionsDecorator`: wraps a `NamedTypesDecorator` and records every create/update/delete as a reversible `Transition` in a sidecar log store. Supports explicit transactions with commit/rollback, two commit modes, three retention policies (infinite/sized/chunked) and crash recovery (auto-rollback of orphaned transitions + replay of committed-but-unapplied transitions). Decorator is opt-in — bare `NamedTypesDecorator` behaves identically. Adds 14 integration tests mirroring the C# `TransactionsDecoratorTests` plus 2 unit tests inside the module.
Mirrors the C# `VersionControlDecorator`: sits above the `TransactionsDecorator` and adds time travel (`checkout`), branching (`branch`, `switch_branch`), and tagging (`tag`) over the transitions log. Persists branch/tag/applied-pointer markers in a sidecar `.versioncontrol.links` store and rebuilds state on reopen. Adds 11 integration tests mirroring the C# `VersionControlDecoratorTests` and 3 module-level unit tests covering marker round-tripping and the sidecar filename convention.
…ecorators Adds 13 new CLI flags mirroring the C# command surface (--transactions, --transactions-file, --commit-mode, --retention, --vc, --vc-file, --branch, --branch-from, --checkout, --tag, --list-branches, --list-tags, --log) and three execution paths in main.rs: bare, transactions-wrapped, and version-control-wrapped. Implements NamedTypeLinks for both TransactionsDecorator and VersionControlDecorator so the query processor can operate at any layer of the stack. Adds search / get_or_create / ensure_created accessors needed by the trait. Cleans up clippy lints: boxes the Cli payload in CliCommand::Run, derives Default on LogRetentionPolicy via the new attribute syntax, and uses BTreeMap::Entry in the default-branch attribution loop.
…ntrol Covers both flag parsing (transactions/vc family + inline-value forms, implies-transactions semantics, rejection of bad branch-from values) and end-to-end binary behavior (sidecar creation, --log output, --list-branches/--list-tags, --tag round-trip, --commit-mode and --retention error paths, and the R8/R17 no-flags no-sidecar guarantee).
One README + two shell scripts per layer, mirroring each other across C# and Rust. The scripts drive the same flag surface end-to-end so the demos exercise sidecar creation, log inspection, commit modes, all three retention policies, tags, branches, and time-travel checkout. Each script runs against a fresh tmp directory so multiple runs stay isolated. All four scripts have been smoke-tested locally and produce the expected output on both implementations.
…yers Adds documentation coverage for the new --transactions and --vc flag families across REQUIREMENTS.md, ARCHITECTURE.md, HOW-IT-WORKS.md, and both per-implementation READMEs so users can discover the layers, find the demo scripts under examples/, and understand the decorator stack (LinkStorage -> NamedTypesDecorator -> TransactionsDecorator -> VersionControlDecorator).
…s and version-control Adds a C# changeset (minor) and Rust changelog fragment (minor) so the release automation can roll the optional transactions and version-control layers into the next release notes for both packages.
Working session summaryBackground still polling. Let me wait until I'm notified. This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $31.500627📊 Context and tokens usage:Claude Opus 4.7: (10 sub-sessions)
Total: (26.8K new + 1.1M cache writes + 32.9M cache reads) input tokens, 322.1K output tokens, $31.500627 cost 🤖 Models used:
📎 Log file uploaded as Gist (12525KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
🔄 Auto-restart triggered (iteration 1)Reason: CI failures detected Starting new session to address the issues. Auto-restart-until-mergeable mode is active. This run will stop after 5 restart iterations. |
Split the value types (TransitionKind, CommitMode, LogRetentionPolicy, DoubletLink, Transition) and marker prefix constants out of transactions/mod.rs into a new transactions/types.rs submodule so the parent module stays under the 1000-line file-size gate enforced by rust/scripts/check-file-size.rs. mod.rs drops from 1002 to ~797 lines; public API is preserved via re-exports.
Working session summaryAll CI checks now pass — including the previously failing Lint and Format Check, Test (macos-latest), and the Rust/C# pipelines. Summary of what was fixed:
Commit: PR: #95 This summary was automatically extracted from the AI working session output. |
🔄 Auto-restart-until-mergeable Log (iteration 1)This log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $3.304431📊 Context and tokens usage:
Total: (67 new + 94.3K cache writes + 4.5M cache reads) input tokens, 19.4K output tokens, $3.304431 cost 🤖 Models used:
📎 Log file uploaded as Gist (14037KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
|
Double check the best quality, architecture, 100% tests coverage, docs and so on, so everything is reliable and would be perfect. Also we need to add standard ACID test for databases, with all layers that are in place. We need to ensure all changes are correct, consistent, validated, tested, documented, logged and fully meet each and all discussed requirements in deepest and widest possible sense (check issue description and all comments in issue and in pull request, make sure each and every requirement listed before actually checking if they were addressed). Ensure all CI/CD checks pass. Please plan and execute everything in a single pull request, you have unlimited time and context, as context auto-compacts and you can continue indefinitely, until it is each and every requirement fully addressed, and everything is totally done. |
|
🤖 AI Work Session Started Starting automated work session at 2026-05-20T15:25:34.947Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback. |
Working session summaryDone. PR #95 is updated and ready for review: #95 Committed and pushed
Verification:
This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:
Total: (402.9K + 14.2M cached) input tokens, 70.6K output tokens, $21.433732 cost 🤖 Models used:
📎 Log file uploaded as Repository (96805KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
Summary
Closes #94 by shipping optional transactions and version-control layers across C# and Rust, with CLI and library surfaces, sidecar doublets stores, documentation, examples, and release wiring.
This follow-up pass addresses the latest PR feedback by tightening the full-stack ACID behavior:
NamedTypesDecorator -> TransactionsDecorator -> VersionControlDecorator) for rollback atomicity/isolation, branch isolation, commit consistency, and durability after reopening the sidecar stores.NamedTypesDecoratordisposal deterministic so tests and callers can close and reopen the same data/log/version-control sidecar files in-process.Implemented Scope
Test Plan
dotnet restore csharp/Foundation.Data.Doublets.Cli.slndotnet build csharp/Foundation.Data.Doublets.Cli.sln --no-restore --configuration Releasedotnet test csharp/Foundation.Data.Doublets.Cli.sln --no-build --configuration Release --verbosity normal— 212 tests passeddotnet test csharp/Foundation.Data.Doublets.Cli.Tests/Foundation.Data.Doublets.Cli.Tests.csproj --filter "VersionControlDecoratorTests|TransactionsDecoratorTests" --logger "console;verbosity=minimal"— 25 targeted tests passedcargo fmt --manifest-path rust/Cargo.toml --all -- --checkcargo clippy --manifest-path rust/Cargo.toml --all-targets --all-featurescargo test --manifest-path rust/Cargo.toml --test transactions_decorator_tests --test version_control_decorator_tests— 27 targeted tests passedcargo test --manifest-path rust/Cargo.toml --all-features --verbosecargo test --manifest-path rust/Cargo.toml --doc --verbosecargo build --manifest-path rust/Cargo.toml --release --verboserust-script rust/scripts/check-file-size.rs— all files within limit; existing warning remains forrust/src/query_processor.rsat 994 linesnode --test csharp/scripts/*.test.mjs— 24 tests passedgit diff --checkNotes:
ChangesSimplifier.cs; no new build errors were introduced.08a5ba7: Docs, WebAssembly, Rust CI/CD Pipeline, and C# CI/CD Pipeline are green; release/deploy jobs that do not run for this PR were skipped.Fixes #94